/* Replication file for Horowitz, McDermott, Stam "Leader Age, Regime Type, and Violent International Relations", Journal of Conflict Resolution, October 2005 */
/* Remember to change the file locations to fit the location of your data, etc. */

clear

log using "C:\Documents and Settings\Michael Horowitz\My Documents\HorowitzMcDermottStamJCRPaper\HorowitzMcDermottStam2005Replication.log", replace

/* Replication file for Horowitz, McDermott, Stam "Leader Age, Regime Type, and Violent International Relations", Journal of Conflict Resolution, October 2005 */
/* If you have questions, comments, and/or find errors, please contact Michael Horowitz at horowitz@fas.harvard.edu */
/* Loading the dataset, etc. */

set memory 1000m
set matsize 800
use "C:\Documents and Settings\Michael Horowitz\My Documents\HorowitzMcDermottStamJCRPaper\HorowitzMcDermottStam2005Replication.dta", clear

/* Table 1 */
mlogit dv5 bofcowdy armgr85 satisdy defpact cwpceyrs1 cwpceyrs2 cwpceyrs3 age1 age2 lengthmod1 lengthmod2 if year>1945 & year<2000, robust 

/* Resetting the results using the xi3 command to generate the data for the figures -- also checks to make sure the xi3 is functioning as described by replicating the data run above */

xi3: mlogit dv5 bofcowdy armgr85 satisdy defpact cwpceyrs1 cwpceyrs2 cwpceyrs3 age1 age2 lengthmod1 lengthmod2 if year>1945 & year<2000, robust 

/* Generating Figures 1-4 -- the actual figures were generated taking the data generated by these figures, inputting them into Excel, and taking Relative Risks -- but this procedure generates the relevant data and figures that look exactly the same, just without the relative risks */

/* These two together make up Figure 1 - note that for these and the rest of figure 1-4, the curves look slightly different than in the paper because it is calculating the raw substantive effect of one variable, not adjusting the scale based on the inclusion of another variable in the figure, like the figures in the paper itself */
postgr3 age1, outcome(1) table
graph save "C:\Documents and Settings\Michael Horowitz\My Documents\HorowitzMcDermottStamJCRPaper\Figure1partA.gph", replace

postgr3 age2, outcome(1) table
graph save "C:\Documents and Settings\Michael Horowitz\My Documents\HorowitzMcDermottStamJCRPaper\Figure1partB.gph", replace

/* These two together make up Figure 2 */
postgr3 age1, outcome(2) table
graph save "C:\Documents and Settings\Michael Horowitz\My Documents\HorowitzMcDermottStamJCRPaper\Figure2partA.gph", replace

postgr3 age2, outcome(2) table
graph save "C:\Documents and Settings\Michael Horowitz\My Documents\HorowitzMcDermottStamJCRPaper\Figure2partB.gph", replace

/* These two together make up Figure 3 */
postgr3 age1, outcome(3) table
graph save "C:\Documents and Settings\Michael Horowitz\My Documents\HorowitzMcDermottStamJCRPaper\Figure3partA.gph", replace

postgr3 age2, outcome(3) table
graph save "C:\Documents and Settings\Michael Horowitz\My Documents\HorowitzMcDermottStamJCRPaper\Figure3partB.gph", replace

/* These two together make up Figure 4 */
postgr3 age1, outcome(4) table
graph save "C:\Documents and Settings\Michael Horowitz\My Documents\HorowitzMcDermottStamJCRPaper\Figure4partA.gph", replace

postgr3 age2, outcome(4) table
graph save "C:\Documents and Settings\Michael Horowitz\My Documents\HorowitzMcDermottStamJCRPaper\Figure4partB.gph", replace

clear

use "C:\Documents and Settings\Michael Horowitz\My Documents\HorowitzMcDermottStamJCRPaper\HorowitzMcDermottStam2005Replication.dta", clear

/*  Table 1 extended to the 1875-2002 period */
mlogit dv5 bofcowdy armgr85 satisdy defpact cwpceyrs1 cwpceyrs2 cwpceyrs3 age1 age2 lengthmod1 lengthmod2, robust 

/* Table 2 -- Parts 1, 2, and 3 in combination equal Table 2 */

/* Part 1 of Table 2: Democratic Regimes */
mlogit dv5 bofcowdy armgr85 satisdy defpact cwpceyrs1 cwpceyrs2 cwpceyrs3 dem1 age1 AgeDem1 dem2 age2 AgeDem2 lengthmod1 lengthmod2 if year>1945 & year<2000, robust 

/* Part 2 of Table 2: Personalist Regimes */
mlogit dv5 bofcowdy armgr85 satisdy defpact cwpceyrs1 cwpceyrs2 cwpceyrs3 personalist1 age1 agepers1 personalist2 age2 agepers2 lengthmod1 lengthmod2 if year>1945 & year<2000, robust 

/* Part 3 of Table 2: Baseline Regimes */
mlogit dv5 bofcowdy armgr85 satisdy defpact cwpceyrs1 cwpceyrs2 cwpceyrs3 baseline1 age1 agebase1 age2 baseline2 agebase2 lengthmod1 lengthmod2 if year>1945 & year<2000, robust 

/* Generating Figures 5 and 6 */

/* Figure 5  -- No regime type interaction -- personalist regimes */
mlogit dv5 bofcowdy armgr85 satisdy defpact cwpceyrs1 cwpceyrs2 cwpceyrs3 personalist1 age1 personalist2 age2 lengthmod1 lengthmod2 if year>1945 & year<2000, robust 

xi3: mlogit dv5 bofcowdy armgr85 satisdy defpact cwpceyrs1 cwpceyrs2 cwpceyrs3 personalist1 age1 personalist2 age2 lengthmod1 lengthmod2 if year>1945 & year<2000, robust 

postgr3 age1, by(personalist1) outcome(1) table

graph save "C:\Documents and Settings\Michael Horowitz\My Documents\HorowitzMcDermottStamJCRPaper\Figure5.gph", replace

clear

use "C:\Documents and Settings\Michael Horowitz\My Documents\HorowitzMcDermottStamJCRPaper\HorowitzMcDermottStam2005Replication.dta", clear

/* Figure 6  -- Includes regime type interaction -- personalist regimes */
mlogit dv5 bofcowdy armgr85 satisdy defpact cwpceyrs1 cwpceyrs2 cwpceyrs3 personalist1 age1 agepers1 personalist2 age2 agepers2 lengthmod1 lengthmod2 if year>1945 & year<2000, robust 

/* Resetting the results using the xi3 command to generate the data for the figures */

xi3: mlogit dv5 bofcowdy armgr85 satisdy defpact cwpceyrs1 cwpceyrs2 cwpceyrs3 i.personalist1*age1 i.personalist2*age2 lengthmod1 lengthmod2 if year>1945 & year<2000, robust 

postgr3 age1, by(personalist1) outcome(1) table

graph save "C:\Documents and Settings\Michael Horowitz\My Documents\HorowitzMcDermottStamJCRPaper\Figure6.gph", replace

/* Generating additional figures discussed in author's note and footnotes */

clear

use "C:\Documents and Settings\Michael Horowitz\My Documents\HorowitzMcDermottStamJCRPaper\HorowitzMcDermottStam2005Replication.dta", clear

/* Additional Democracy Figures */

xi3: mlogit dv5 bofcowdy armgr85 satisdy defpact cwpceyrs1 cwpceyrs2 cwpceyrs3 i.dem1*age1 i.dem2*age2 lengthmod1 lengthmod2 if year>1945 & year<2000, robust 

postgr3 age1, by(dem1) outcome(1) table
graph save "C:\Documents and Settings\Michael Horowitz\My Documents\HorowitzMcDermottStamJCRPaper\AdditionalFiguresDemA1.gph", replace
postgr3 age1, by(dem1) outcome(2) table
graph save "C:\Documents and Settings\Michael Horowitz\My Documents\HorowitzMcDermottStamJCRPaper\AdditionalFiguresDemA2.gph", replace
postgr3 age1, by(dem1) outcome(3) table
graph save "C:\Documents and Settings\Michael Horowitz\My Documents\HorowitzMcDermottStamJCRPaper\AdditionalFiguresDemA3.gph", replace
postgr3 age1, by(dem1) outcome(4) table
graph save "C:\Documents and Settings\Michael Horowitz\My Documents\HorowitzMcDermottStamJCRPaper\AdditionalFiguresDemA4.gph", replace
postgr3 age2, by(dem2) outcome(1) table
graph save "C:\Documents and Settings\Michael Horowitz\My Documents\HorowitzMcDermottStamJCRPaper\AdditionalFiguresDemB1.gph", replace
postgr3 age2, by(dem2) outcome(2) table
graph save "C:\Documents and Settings\Michael Horowitz\My Documents\HorowitzMcDermottStamJCRPaper\AdditionalFiguresDemB2.gph", replace
postgr3 age2, by(dem2) outcome(3) table
graph save "C:\Documents and Settings\Michael Horowitz\My Documents\HorowitzMcDermottStamJCRPaper\AdditionalFiguresDemB3.gph", replace
postgr3 age2, by(dem2) outcome(4) table
graph save "C:\Documents and Settings\Michael Horowitz\My Documents\HorowitzMcDermottStamJCRPaper\AdditionalFiguresDemB4.gph", replace

clear

use "C:\Documents and Settings\Michael Horowitz\My Documents\HorowitzMcDermottStamJCRPaper\HorowitzMcDermottStam2005Replication.dta", clear

/* Additional Personalist Figures -- note this is the same data run used to generate Table 2 and Figure 6 */   
         
xi3: mlogit dv5 bofcowdy armgr85 satisdy defpact cwpceyrs1 cwpceyrs2 cwpceyrs3 i.personalist1*age1 i.personalist2*age2 lengthmod1 lengthmod2 if year>1945 & year<2000, robust 
                     
postgr3 age1, by(personalist1) outcome(1) table
graph save "C:\Documents and Settings\Michael Horowitz\My Documents\HorowitzMcDermottStamJCRPaper\AdditionalFiguresPersonalistA1.gph", replace
postgr3 age1, by(personalist1) outcome(2) table
graph save "C:\Documents and Settings\Michael Horowitz\My Documents\HorowitzMcDermottStamJCRPaper\AdditionalFiguresPersonalistA2.gph", replace
postgr3 age1, by(personalist1) outcome(3) table
graph save "C:\Documents and Settings\Michael Horowitz\My Documents\HorowitzMcDermottStamJCRPaper\AdditionalFiguresPersonalistA3.gph", replace
postgr3 age1, by(personalist1) outcome(4) table
graph save "C:\Documents and Settings\Michael Horowitz\My Documents\HorowitzMcDermottStamJCRPaper\AdditionalFiguresPersonalistA4.gph", replace
postgr3 age2, by(personalist2) outcome(1) table
graph save "C:\Documents and Settings\Michael Horowitz\My Documents\HorowitzMcDermottStamJCRPaper\AdditionalFiguresPersonalistB1.gph", replace
postgr3 age2, by(personalist2) outcome(2) table
graph save "C:\Documents and Settings\Michael Horowitz\My Documents\HorowitzMcDermottStamJCRPaper\AdditionalFiguresPersonalistB2.gph", replace
postgr3 age2, by(personalist2) outcome(3) table
graph save "C:\Documents and Settings\Michael Horowitz\My Documents\HorowitzMcDermottStamJCRPaper\AdditionalFiguresPersonalistB3.gph", replace
postgr3 age2, by(personalist2) outcome(4) table
graph save "C:\Documents and Settings\Michael Horowitz\My Documents\HorowitzMcDermottStamJCRPaper\AdditionalFiguresPersonalistB4.gph", replace

clear

use "C:\Documents and Settings\Michael Horowitz\My Documents\HorowitzMcDermottStamJCRPaper\HorowitzMcDermottStam2005Replication.dta", clear

/* Additional Baseline Figures */   
                    
xi3: mlogit dv5 bofcowdy armgr85 satisdy defpact cwpceyrs1 cwpceyrs2 cwpceyrs3 i.baseline1*age1 i.baseline2*age2 lengthmod1 lengthmod2 if year>1945 & year<2000, robust
                   
postgr3 age1, by(baseline1) outcome(1) table
graph save "C:\Documents and Settings\Michael Horowitz\My Documents\HorowitzMcDermottStamJCRPaper\AdditionalFiguresBaselineA1.gph", replace
postgr3 age1, by(baseline1) outcome(2) table
graph save "C:\Documents and Settings\Michael Horowitz\My Documents\HorowitzMcDermottStamJCRPaper\AdditionalFiguresBaselineA2.gph", replace
postgr3 age1, by(baseline1) outcome(3) table
graph save "C:\Documents and Settings\Michael Horowitz\My Documents\HorowitzMcDermottStamJCRPaper\AdditionalFiguresBaselineA3.gph", replace
postgr3 age1, by(baseline1) outcome(4) table
graph save "C:\Documents and Settings\Michael Horowitz\My Documents\HorowitzMcDermottStamJCRPaper\AdditionalFiguresBaselineA4.gph", replace
postgr3 age2, by(baseline2) outcome(1) table
graph save "C:\Documents and Settings\Michael Horowitz\My Documents\HorowitzMcDermottStamJCRPaper\AdditionalFiguresBaselineB1.gph", replace
postgr3 age2, by(baseline2) outcome(2) table
graph save "C:\Documents and Settings\Michael Horowitz\My Documents\HorowitzMcDermottStamJCRPaper\AdditionalFiguresBaselineB2.gph", replace
postgr3 age2, by(baseline2) outcome(3) table
graph save "C:\Documents and Settings\Michael Horowitz\My Documents\HorowitzMcDermottStamJCRPaper\AdditionalFiguresBaselineB3.gph", replace
postgr3 age2, by(baseline2) outcome(4) table
graph save "C:\Documents and Settings\Michael Horowitz\My Documents\HorowitzMcDermottStamJCRPaper\AdditionalFiguresBaselineB4.gph", replace

clear
                                       
log close
